<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>红包模板</title>
    <link rel="stylesheet" href="/red/lib/reset.css">
    <link rel="stylesheet" href="/layui/css/layui.css">
    <link rel="stylesheet" href="/red/lib/all.css">
    <link rel="stylesheet" href="/hyqcss/public.css">
    <style type="text/css">
        body{
            background: #e9e9e9;
        }
        /*公共头部带搜索*/
        .public_container{
            margin: 20px;
            background: #fff;
        }
        .public_title_container{
            height: 54px;
            padding: 0 20px;
            font-size: 14px;
            display: flex;
            align-items: center;
            background: #f9f9f9;
            border-bottom: 1px solid #f0f0f0;
        }
        .public_title_container a{
            margin-right: 30px;
            height: 54px; 
            line-height: 54px;
            cursor: pointer;
        }
        .public_title_active{
            color: #1E9FFF;
            border-bottom: 1px solid #1E9FFF;
        }
        .public_buttonSearch_container{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background: #fff;
        }
        .public_buttonSearch_containers{
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background: #fff;
        }
        .public_Search_container{
            position: relative;
        }
        .public_Search_container input{
            width: 240px;
            height: 32px;
            border: 1px solid #d9d9d9;
        }
        .public_Search_container i{
            position: absolute;
            bottom: 6px;
            right: 10px;
            cursor: pointer;
        }
        /*公共头部带搜索 end*/
        .public_table_container{
            padding: 0 20px 20px 20px;
        }
        .public_Search_content{
            display: flex;
        }
        .public_Search_content a{
            color: #fff;
            background-color: #1E9FFF;
            text-shadow: 0 -1px 0 rgba(0,0,0,.12);
            height: 24px;
            padding: 4px 15px;
            font-size: 14px;
            border-radius: 2px;
            display: flex;
            cursor: pointer;
            align-items: center;
        }
        .public_SearchSelect_content input{
            height: 32px;
        }
        .public_SearchSelect_content{
            margin-right: 10px;
        }
        .public_buttonSearch_content{
            display: flex;
        }
        .public_buttonSearch_content a{
            color: #fff;
            background-color: #1E9FFF;
            text-shadow: 0 -1px 0 rgba(0,0,0,.12);
            height: 24px;
            padding: 4px 15px;
            font-size: 14px;
            border-radius: 2px;
            display: flex;
            cursor: pointer;
            align-items: center;
        }
        .public_buttonSearch_content span{
            color: rgba(0,0,0,0.65);
            background-color: #fff;
            height: 32px;
            padding: 4px 15px;
            font-size: 14px;
            border-radius: 2px;
            display: flex;
            align-items: center;
            border: 1px solid #d9d9d9;
            margin-left: 10px;
        }
        .public_buttonSearch_daoruhuashu{
            margin-left: 10px;
        }
      
        #area-picker .layui-edge{
        	right: 20px;
        }
    </style>
</head>
<body>
<!-- 顶部提示框 开始 -->
    <div class="public_tipSetting_contaienr">
        <div class="public_tipSetting_content">
            <p>使用红包需先在微信支付后台开通企业付款到零钱功能，本功能可以实现使用企业微信向个人或微信群发放红包。</p>
            <a href="https://support.qq.com/products/174823/faqs/83871" target="_blank">查看教程</a>
            <svg t="1599462804099" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8813" width="15" height="15"><path d="M512 102.4a409.6 409.6 0 1 0 409.6 409.6 409.6 409.6 0 0 0-409.6-409.6z m181.248 518.144a51.2 51.2 0 0 1-72.704 72.704L512 584.192l-108.544 109.056a51.2 51.2 0 0 1-72.704-72.704L439.808 512 330.752 403.456a51.2 51.2 0 0 1 72.704-72.704L512 439.808l108.544-109.056a51.2 51.2 0 0 1 72.704 72.704L584.192 512z" fill="" p-id="8814"></path></svg>
        </div>
    </div>
    <!-- 顶部提示框 结束 -->
<div class="main">
    <div class="" style="width: 100%;">
        <div class="" style="background: #e9e9e9; padding: 20px;">
            <div class="public_content">
                <div class="public_title_container">
                    <a class="public_title_active navigation_1">红包模板</a>
                    <a href="data_base.html">数据统计</a>
                    <a class="navigation_3">参数配置</a>
                    <a class="navigation_4">红包封标配置</a>
                </div>
                <div class="public_buttonSearch_container">
                    <div class="public_buttonSearch_content">
                        <a class="showmoeny">创建红包模板</a>
                    </div>
                    
                </div>
            </div>
            <div class="container tab-body" style="padding-top: 0;">
                <div class="nav_1">
                    <table class="layui-table" lay-skin="line" style="margin-top: 0;">
                        <colgroup>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col>
                            <col width="100px">
                            <col width="230px">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>红包名称</th>
                            <th>红包类形</th>
                            <th>单个红包金额</th>
                            <th>剩余发送次数</th>
                            <th>红包祝福语</th>
                            <th>领取限制</th>
                            <th>地区限制</th>
                            <th>创建时间</th>
                            <th>状态</th>
                            <th style="text-align: right">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {loop $redguest as $value}
                        <tr>
                            <td>{$value->red_name}</td>
                            <td>{if $value->red_status==1}普通红包{else}随机红包{/if}</td>
                            <td>{$value->red_price}</td>
                            <td>{$value->red_size}</td>
                            <td>{$value->red_greeting}</td>
                            <td>{if $value->red_get==1}仅限新客领取{else}新客老客均可领取{/if}</td>
                            <td>{if $value->red_area==1}无限制{else}按距离{/if}</td>
                            <td>{date("Y-m-d H:i:s",$value->ctime)}</td>
                            <td>
                                {if $value->status==1}<span class="table-public-label">使用中</span>{else}<span class="table-public-label">停用</span>{/if}
                            </td>
                            <td class="text-right">
                                {if $value->status == 1}
                                    <span class="table-public-btn" onclick="ting('{$value->id}')">停用</span>
                                {else}
                                    <span class="table-public-btn" onclick="upd_status('{$value->id}')">开启</span>
                                {/if}
                                <span class="table-public-btn" onclick="uphb('{$value->id}')">修改</span>
                                <span class="table-public-btn" onclick="dehb('{$value->id}')">删除</span>
                            </td>
                        </tr>
                        {/loop}
                        </tbody>
                    </table>
                    <!-- 公共表格部分 end-->
                    <div class="main-container-h pageing-container-h">
                            <div class="pageing-content-h">
                               <span>{$p->totalnum}条/{$p->totalpage}页</span> 
                            </div>
                            <ul class="pageing-content-h">
                               {P weidogsadmin}
                            </ul>
                    </div>
                </div>
                <div class="nav_3" style="display:none; padding-top: 20px;">
                    <form class="layui-form" action="#">
                        <div class="public_form_List">
                        <div class="layui-form-item">
                        <label class="layui-form-label">支付模式：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="1" lay-filter="status" title="自有支付"  {if $confing->status != 2} checked{/if}>
                                <input type="radio" name="status" value="2" lay-filter="status" title="借用支付"  {if $confing->status == 2} checked{/if} >
                            </div>
                        </div>
                    </div>
                   </form>
                   <div id="page_set" {if $confing->status != 1} style="display:none;" {/if} >
                        <div class="layui-form-item" >
                            <label class="layui-form-label">商户号<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" id="mchid" required lay-verify="required" placeholder="请填写正确的mchid" autocomplete="off" class="layui-input" value="{$confing->mchid}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">API密钥<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" id="apiKey" required lay-verify="required" placeholder="请填写正确的apiKey" autocomplete="off" class="layui-input" value="{$confing->apiKey}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">企业证书1：apiclient_cert<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <button type="button" class="layui-btn layui-btn-normal" id="test1" onclick="falses(); ">上传企业证书</button>
                                    <input type="text"  id="demospan1" required lay-verify="required" autocomplete="off" class="layui-input" style="border:none" disabled value="{$confing->cert_one}">
                                    <input type="file" hidden id="filkes"/>
                                </div>
                            </div>
                        </div> 
                        <div class="layui-form-item">
                            <label class="layui-form-label">企业证书2：apiclient_key<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <button type="button"  class="layui-btn layui-btn-normal" id="test2" onclick="falsesone(); ">上传企业证书</button>
                                    <input type="text" id="demospan2" required lay-verify="required" autocomplete="off" class="layui-input" style="border:none" disabled value="{$confing->cert_tow}">
                                    <input type="file" hidden id="filkeone"/>
                                </div>
                            </div>
                        </div> 
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-normal" id="update_confing">修改配置</button>
                        </div>
                    </div>
                </div>
                <div class="nav_4" style="display:none; padding-top: 20px;">
                    <div class="layui-form-item">
                            <label class="layui-form-label">红包标题<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" id="red_title" required lay-verify="required" placeholder="请填写您的红包标题" autocomplete="off" class="layui-input" value="{$cover->red_title}">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">红包欢迎语<span style="color:red;">*</span></label>
                            <div class="layui-input-block">
                                <input type="text" id="red_content" required lay-verify="required" placeholder="请填写您的红包欢迎语" autocomplete="off" class="layui-input" value="{$cover->red_content}">
                            </div>
                        </div>
                        <input type="hidden" id="red_id" value="{$cover->id}" />
                        <div class="layui-form-item">
                            <label class="layui-form-label">上传红包封面<span style="color:red;">*</span></label>
                            <div class="pushSOP_sendContentImg_container0 punlic_sendContent_container0" >
                                <button type="button" class="layui-btn layui-btnssss layui-btn-normal" data-id="tt0" id="test">上传红包头像</button>
                                <input type="file" hidden id="hide" />
                                <div class="layui-upload-list" style="margin-left: 130px;">
                                    <img class="layui-upload-img" id="demo" src="{$cover->red_image}"{if !$cover->red_image} style="display:none;"{/if}>
                                    <input type="hidden" id="demos" name="file" />
                                    <p id="demoText0"></p>
                                </div>
                            </div>  
                        </div> 
                        <div class="layui-form-item">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-normal" id="update_red_confing">修改配置</button>
                            </div>
                        </div>
                </div>  
            </div>
        </div>
    </div>
</div>

<div id="money" style="display: none">
    <form class="layui-form mt" action="add.html">
        <div class="layui-form-item">
            <label class="layui-form-label">红包名称：</label>
            <div class="layui-input-block">
                <input type="text" name="name" required lay-verify="required" placeholder="请输入红包名称，最多十个字" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">红包类形：</label>
            <div class="layui-input-block">
              <input type="radio" name="sexs" value="1" title="普通红包" checked="">
              <input type="radio" name="sexs" value="2" title="拼手气红包">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">单个红包金额：</label>
            <div class="layui-input-block">
                <input type="text" name="price" required lay-verify="required" placeholder="最低金额大于0.3" autocomplete="off"
                       class="layui-input" onkeyup="clearNoNum(this)">
                <span style="margin-left: 20px;font-size: 10px;color: #999;">可输入0.3-200元之间的数字，只支持小数点后两位</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">红包数量：</label>
            <div class="layui-input-block">
                <input type="text" name="size" required lay-verify="required" placeholder="红包数量必须大于1" autocomplete="off"
                       class="layui-input">
                <span style="margin-left: 20px;font-size: 10px;color: #999;">可输入1-100000之间的数字</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">红包祝福语：</label>
            <div class="layui-input-block">
                <input type="text" name="greeting" required lay-verify="required" placeholder="恭喜发财，大吉大利" autocomplete="off"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">领取限制：</label>
            <div class="layui-input-block">
              <input type="radio" name="get" value="1" title="仅限新客领取" checked="">
              <input type="radio" name="get" value="2" title="新客老客均可领取"><br>
              <span style="font-size: 10px;color: #999;">客户首次添加企业成员为好友即可领取：若客户之前添加过企业的任意成员或删除好友重新添加将无法领取红包</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">地区限制：</label>
            <div class="layui-input-block">
              <input type="radio" name="areasetting" lay-filter="areasetting" value="1" title="无限制" checked="">
              <input type="radio" name="areasetting" lay-filter="areasetting" value="3" title="按距离">
              <!-- <input type="radio" name="areasetting" lay-filter="areasetting" value="2" title="按城市"> -->
            </div>
        </div>

        <div class="layui-form-item selectAddress" style="display: none;">
            <label class="layui-form-label">地图坐标：</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="lng" id="lng" placeholder="" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="lat" id="lat" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item selectAddress" style="display: none;">
            <label class="layui-form-label">地址：</label>
            <div class="layui-input-inline">
                <input type="text" id="address" name="address" value="" autocomplete="off" class="layui-input" data-rule-maxlength ="140"style="width: 300px;"/>
                
            </div>
            <div class="layui-form-mid layui-word-aux"><a href="javascript:;"  style="color: blue;margin-left: 100px;" onclick="codeAddress()">搜索坐标</a></div>
        </div>
        <div class="layui-form-item selectAddress" style="display: none;">
            <label class="layui-form-label"></label>
            <div class="" id="container" style="max-width:600px;min-height:300px;"></div>
        </div>
        <div class="layui-form-item selectAddress" style="display: none;">
            <div class="layui-form-label">距离范围：</div>
            <div class="layui-input-inline" style="width: 200px;">
                <input type="number" class="layui-input" step="1" min="0" name="distance_range" value="" placeholder="请输入距离范围(单位: km)">
            </div>
        </div>
        <!-- 省市区 -->
 <!--        <div class="layui-form-item selectCity" id="area-picker" style="display: none;">
            <div class="layui-form-label"></div>
            <div class="layui-input-inline" style="width: 200px;">
                <select name="province" class="province-selector" data-value="广东省" lay-filter="province-1">
                    <option value="">请选择省</option>
                </select>
            </div>
            <div class="layui-input-inline" style="width: 200px;">
                <select name="city" class="city-selector" data-value="深圳市" lay-filter="city-1">
                    <option value="">请选择市</option>
                </select>
            </div>
            <div class="layui-input-inline" style="width: 200px;">
                <select name="county" class="county-selector" data-value="龙岗区" lay-filter="county-1">
                    <option value="">请选择区</option>
                </select>
            </div>
        </div> -->
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="formDemo">创建</button>
            </div>
        </div>
    </form>
</div>
<script src="/red/lib/jquery-3.1.0.min.js"></script>
<script src="/red/lib/layui.js"></script>
<script src="/js/ajax.js"></script>
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=MLGBZ-2TG32-6KOUF-CIOJ6-BENLJ-Z5BHQ"></script>
<script type="text/javascript">
function clearNoNum(obj) {
    obj.value = obj.value.replace(/[^\d.]/g, "");  //清除“数字”和“.”以外的字符
    obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
    obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');//只能输入两个小数
    if (obj.value.indexOf(".") < 0 && obj.value != "") {//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
       obj.value = parseFloat(obj.value);
    }
}
</script>
<script type="text/javascript">
    $("#test").on("click",function(){
        $("#hide").trigger("click");
        openuploadsones();
    });

    function openuploadsones(){
         $("#hide").change(function () {
            var formdata = new FormData();
            formdata.append('file', $("#hide")[0].files[0]); //获取file信息
            $.ajax({
                url: "add_file.html",
                type: 'post',
                data: formdata,
                cache: false,
                dataType: 'json',
                processData: false,
                contentType: false,
                success: function (e) {
                    if(e.status == "success"){
                        tusi(e.msg);
                        $("#demo").attr("style","display:block");
                        $("#demo").attr("src",e.data.filePath);
                        $("#demos").attr("value",e.data.filePath);
                    }else{
                        tusi(e.msg);
                    }
                }
            });
        });
    }

  $("#update_red_confing").on("click",function(){
    var red_title = $("#red_title").val();
    var red_content = $("#red_content").val();
    var red_file = $("#demos").val();
    var red_id = $("#red_id").val();
    myAjaxPost(false, true, 'update_red_confing.html', { red_title:red_title,red_content:red_content,red_file:red_file,red_id:red_id}, function (resp) {
        tusi(resp.msg);
    })
  });
</script>
<!-- 省市区 -->
<script>
    //配置插件目录
    layui.config({
        base: '/mods/'
        , version: '1.0'
    });
    //一般直接写在一个js文件中
    layui.use(['layer', 'form', 'layarea'], function () {
        var layer = layui.layer
            , form = layui.form
            , layarea = layui.layarea;

        layarea.render({
            elem: '#area-picker',
            change: function (res) {
                //选择结果
                console.log(res);
            }
        });
    });
</script>
<script type="text/javascript">
    $('.navigation_1').click(function(){
        $('.nav_1').show();
        $('.nav_3').hide();
        $('.nav_4').hide();
        $('.navigation_1').addClass('public_title_active');
        $('.navigation_3').removeClass('public_title_active');
        $('.navigation_4').removeClass('public_title_active');
        $('.public_buttonSearch_container').css('display','flex');
    })
    $('.navigation_3').click(function(){
        $('.nav_1').hide();
        $('.nav_3').show();
        $('.nav_4').hide();
        $('.navigation_1').removeClass('public_title_active');
        $('.navigation_3').addClass('public_title_active');
        $('.navigation_4').removeClass('public_title_active');
        $('.public_buttonSearch_container').css('display','none');
    })
    $('.navigation_4').click(function(){
        $('.nav_1').hide();
        $('.nav_3').hide();
        $('.nav_4').show();
        $('.navigation_1').removeClass('public_title_active');
        $('.navigation_3').removeClass('public_title_active');
        $('.navigation_4').addClass('public_title_active');
        $('.public_buttonSearch_container').css('display','none');
    })
</script>
<script>
    $("#update_confing ").click(function () {
        var mchid = $("#mchid").val();
        var appid = $("#appid").val();
        var apiKey = $("#apiKey").val();
        var cert_one = $("#demospan1").val();
        var status = $('input[name="status"]:checked').val();
        var cert_tow = $("#demospan2").val();
        if(status == 1){
            if(mchid=="" || appid==""  || apiKey=="" || cert_one=="" || cert_tow==""){
                tusi("必填项不能为空");
                return false;
            }
        }
        myAjaxPost(false, true, 'update_confing.html', { status:status,mchid:mchid,appid:appid,apiKey:apiKey,cert_one:cert_one,cert_tow:cert_tow}, function (resp) {
            tusi(resp.msg);
        })
    })
    
    $(".tab-nav span").click(function () {
        var index = $(this).index();
        $(".tab-body").children().eq(index).show().siblings().hide()
        $(".tab-body2").children().eq(index).show().siblings().hide()
        $(this).addClass('active').siblings().removeClass('active')
    })
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#time',
            value: '',
            range:true
        });
    });
    layui.use('layer', function () {
        var layer = layui.layer;

        $(".showmoeny").click(function () {
            layer.open({
                area: ['800px', '700px'],
                shadeClose: true,
                type: 1,
                title: '创建红包模板',
                content: $('#money') //这里content是一个普通的String
            });
        })
    });
    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;
    });
    function ting(id){
        myAjaxPost(false, true, 'ting.html', { id:id}, function (resp) {
            if(resp.status == 'success'){
                alert(resp.msg);
                history.go(0);
            }else{
                alert(resp.msg);
            }
        });
    }

    function upd_status(id){
        myAjaxPost(false, true, 'upd_status.html', { id:id}, function (resp) {
            if(resp.status == 'success'){
                alert(resp.msg);
                history.go(0);
            }else{
                alert(resp.msg);
            }
        });
    }


    function uphb(id){
        layer.open({
          type: 2,
          title: '修改红包模板页面',
          shadeClose: true,
          shade: 0.2,
          area: ['850px', '640px'],
          content: 'uphb.html?id='+id
        }); 
    }
    function dehb(id){
        myAjaxPost(false, true, 'dehb.html', { id:id}, function (resp) {
            if(resp.status == 'success'){
                alert(resp.msg);
                history.go(0);
            }else{
                alert(resp.msg);
            }
        });
    }
function customer_infos(){
    tusi("暂无客户领取");
}


function customer_info(id){
    location.href='customer_info-'+id+'.html';
}
</script>
<script type="text/javascript">
        $('.public_tipSetting_contaienr svg').click(function(){
            $('.public_tipSetting_contaienr').hide();
        })
        layui.use('form', function(){
          var form = layui.form;
            
          form.render('select');
          
          form.on('select(type)', function(data){
            location.href="quick_reply.html?type="+data.value+"&name="+$('#name').val();
          });
          form.on('radio(status)', function (data) {
            if(data.value == 1){
                $("#page_set").show();
            }else{
                $("#page_set").hide();
            }
         })

          form.on('radio(areasetting)', function (data) {
                if ($('input[name="areasetting"]:checked').val() == "3") {
                    $(".selectAddress").show();
                }
                else if($('input[name="areasetting"]:checked').val() == "1"){
                	$(".selectAddress").hide();
                }
                
                form.render();
            });
        });
    </script>

<script type="text/javascript">
    $(document).on("change","[name='testone']",function(){
        var price = $('#price_one').val();
        var number = $('#number_one').val();
        var username = $('#soukh').val();
        myAjaxPost(false, true, 'sou_index.html', { username:username,name:$("#testone").val(),price:price,number:number}, function (resp) {
            if (resp.status == 'success') {
                var str = "";
                var data_one = resp.data;
                data_one.forEach(function(datas) {
                if(datas.status==0){
                    var num = '已领取';
                }else{
                    var num = '未领取';
                }
                if(datas.user.id){
                    var price = datas.price;
                    var ltime = datas.lstime; 
                }else{
                    var price = '暂无领取记录';
                    var ltime = '暂无领取时间';
                }
                  str +="<tr>";
                  str +="<td>"+price+"</td>";
                  str +="<td>"+datas.cstime+"</td>";
                  if(datas.user.id){
                    str +="<td>";
                    str +="<div class='tx-temp'>";
                    str +="<img src='"+datas.user.avatar+"'>";
                    str +="<p>"+datas.user.name+"</p>";
                    str +="</div>";
                    str +="</td>";
                  }else{
                    str +="<td>暂无领取记录</td>";
                  }
                  str +="<td>"+num+"</td>";
                  str +="<td>"+ltime+"</td>";
                  str +="<td style='text-align: right'>";
                  if(datas.user.id){
                    str +="<span class='href table-public-btn' onclick='customer_info("+datas.user.id+")'>客户详情</span>";
                  }else{
                    str +="<span class='href table-public-btn' onclick='customer_infos()'>客户详情</span>";
                  }
                  str +="</td>";
                  str +="</tr>";
                });
                document.getElementById('trssse').innerHTML = str;
            }else{
                alert(resp.msg);
            }
        });
    })



    function falses() {
        $("#filkes").trigger("click");
        openuploadstow();
    }
    
        function openuploadstow() {
        $("#filkes").change(function () {
            var formdata = new FormData();
            formdata.append('file', $("#filkes")[0].files[0]); //获取file信息
            $.ajax({
                url: "add_file.html",
                type: 'post',
                data: formdata,
                cache: false,
                dataType: 'json',
                processData: false,
                contentType: false,
                success: function (e) {
                    if (e.status == "success") {
                        layer.msg(e.msg, '');
                        var data = e.data.filePath;
                        $("#demospan1").attr('value',data);
                    } else {
                        layer.msg(e.msg, '');
                    }
                }
            });
        });
    }
    
    function falsesone() {
        $("#filkeone").trigger("click");
        openuploadsone();
    }
    
        function openuploadsone() {
        $("#filkeone").change(function () {
            var formdata = new FormData();
            formdata.append('file', $("#filkeone")[0].files[0]); //获取file信息
            $.ajax({
                url: "add_file.html",
                type: 'post',
                data: formdata,
                cache: false,
                dataType: 'json',
                processData: false,
                contentType: false,
                success: function (e) {
                    if (e.status == "success") {
                        layer.msg(e.msg, '');
                        var data = e.data.filePath;
                        $("#demospan2").attr('value',data);
                    } else {
                        layer.msg(e.msg, '');
                    }
                }
            });
        });
    }
       function chong(){
            window.location.href = window.location.href; 
       }
</script>
<script type="text/javascript">
     function blers(){
        var time = $('#time').val();
        myAjaxPost(false, true, 'sou_index.html', { time:time}, function (resp) {
            if (resp.status == 'success') {
                var str = "";
                var data_one = resp.data;
                data_one.forEach(function(datas) {
                if(datas.status==0){
                    var num = '已领取';
                }else{
                    var num = '未领取';
                }
                if(datas.user.id){
                    var price = datas.price;
                    var ltime = datas.lstime; 
                }else{
                    var price = '暂无领取记录';
                    var ltime = '暂无领取时间';
                }
                  str +="<tr>";
                  str +="<td>"+price+"</td>";
                  str +="<td>"+datas.cstime+"</td>";
                  str +="<td>";
                  if(datas.user.id){
                    str +="<div class='tx-temp'>";
                    str +="<img src='"+datas.user.avatar+"'>";
                    str +="<p>"+datas.user.name+"</p>";
                    str +="</div>";
                  }else{
                    "暂无领取记录"
                  }
                  str +="</td>";
                  str +="<td>"+num+"</td>";
                  str +="<td>"+ltime+"</td>";
                  str +="<td style='text-align: right'>";
                  if(datas.user.id){
                    str +="<span class='href table-public-btn' onclick='customer_info("+datas.user.id+")'>客户详情</span>";
                  }else{
                    str +="<span class='href table-public-btn' onclick='customer_infos()'>客户详情</span>";
                  }
                  str +="</td>";
                  str +="</tr>";
                });
                document.getElementById('trssse').innerHTML = str;
            }else{
                alert(resp.msg);
            }
        });
    }
</script>
<script type="text/javascript">
    var check=0;
    initssss();
    function codeAddress() {
        check=0;
        var address = document.getElementById("address").value;
        
        //通过getLocation();方法获取位置信息值
        geocoder.getLocation(address);
    }
    function initssss() {
    var map = new qq.maps.Map(document.getElementById("container"),{
        center: new qq.maps.LatLng({if $m->lat}{$m->lat}{else}39.916527{/if},{if $m->lng}{$m->lng}{else}116.397128{/if}),
        // center: new qq.maps.LatLng(39.916527,116.397128),//线上正式使用 换成上面的写法（依据实际数据去填此除只是默认值）
        zoom: 13
    });
    citylocation = new qq.maps.CityService({
        complete : function(results){
           /* map.setCenter(results.detail.latLng);
            city.style.display = 'inline';
            city.innerHTML = '所在位置: ' + results.detail.name;*/
            console.log(results);
        }
    });
    geocoder = new qq.maps.Geocoder({
        complete : function(result){
            console.log(result);
            $("#lat").val(result.detail.location.lat);
            $("#lng").val(result.detail.location.lng);
            $("#address").val(result.detail.address);
            map.setCenter(result.detail.location);
            if(check==0){
                var str=result.detail.location+"";
                var lengh=str.indexOf(",");
                var lat=str.substring(0,lengh);
                var lng=str.substring(lengh+2);
            }
        
            var marker = new qq.maps.Marker({
                map:map,
                position: result.detail.location
            });
            qq.maps.event.addListener(map, 'click', function(event) {
            marker.setMap(null);      
            }); 
        }
    });
    //添加监听事件   获取鼠标单击事件
    qq.maps.event.addListener(map, 'click', function(event) {
        check=1;
        $("#lat").val(event.latLng.lat);
        $("#lng").val(event.latLng.lng);
         
        geocoder.getAddress(event.latLng);
        citylocation.searchCityByLatLng(event.latLng);
   
        var marker=new qq.maps.Marker({
            position:event.latLng, 
            map:map
        });    
        qq.maps.event.addListener(map, 'click', function(event) {
             marker.setMap(null);      
        });
    });
}
</script>
</body>
</html>